#pragma once
#include "Template.h"
#include <string>
#include <iostream>

using namespace std;

class InterestTable
{
	friend class PersonList;
	friend class Person;
protected:
	List <string> interestList;

public:
	InterestTable(){}
	~InterestTable(){}

	friend ostream &operator <<(ostream &out, InterestTable it)
	{
		out << it.interestList << endl;
		return out;
	}

	void add(string interest)
	{
		interestList.addAtHead(interest);
	}

	bool searchForInterests(Element<string> *str, List<string> &it, int commonInterests)
	{
		int c = 0;
		Element<string> *i = it.head;
		if( i == nullptr)
			return false;
		else
		{
			while(i != nullptr)
			{
				if(i->element_info == str->element_info)
				{
					cout << i->element_info << " *";
					return true;
				}
				cout << i->element_info << endl;
				i = i->next;
			}
		}
		return false;
	}

	List <string> getList()
	{
		return interestList;
	}

	void printList()
	{
		cout << interestList;
	}

};